package com.magictower.primary.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

import com.magictower.primary.db.dao.AddressDao;

/**
 * 监听去电的广播接受者 需要权限: android.permission.PROCESS_OUTGOING_CALLS
 *
 * @author kejunzhan
 * @since 2017/12/12
 */

public class OutCallReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String phone = getResultData();//获取去电手机号
        String address = AddressDao.getAddress(phone);

        Toast.makeText(context, address, Toast.LENGTH_SHORT).show();
    }
}
